<%--<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/layout/tag.jsp"%>
<script type="text/javascript">
	$(document).ready( 
		function() {
			//事件注册.
			$("#saveBtn").click(saveMember);
			$("#returnBtn").click(returnToList);
			$("#modifyPassBtn").click(showPassDlg);
			
			$("#savePassBtn").click(modifyPass);
			$("#cancelStopBtn").click(cancelModifyPass);
			
			//设置左菜单对应菜单CSS为选中状态.
			changeToActiveCss("menu_6010");
			
			//消息显示.
			var msg = '<c:out value="${msg}"/>';
			if (msg != "") {
				alert(msg);
			}
		}
	);
	
	function showPassDlg() {
		$("#passDlg").show().css("top",($(document).height()-150)/2 ).css("left",($(document).width()-400)/2 );
	}
	
	function modifyPass() { 	
		var sysId = $("#sysId").val();
		var newPass = $("#newPass").val().Trim();
		var confirmPass = $("#confirmPass").val().Trim();
		if(newPass == "") {
			alert("请输入新的密码.");
			return false;
		}
		
		if(newPass != confirmPass) {
			alert("两次输入的密码不一致.");
			return false;
		}
		
		var strData = "sysId=" + sysId + "&newPass=" + newPass;
		$.ajax({
			type:"post",
			url:"${pageContext.request.contextPath}/member/modifyPass.do",
			context:this,
			dataType:"json",
			data:strData,
			success:modifyCallBack,
			error:function(){alert("发生了错误.");},
		});
	}
	
	function modifyCallBack(result) {
		if (result.status == "OK") {
			alert(result.msg);
			$("#passDlg").hide();
		} else {
			alert(result.msg);
		}
	}
	
	function cancelModifyPass() {
		$("#newPass").val("");
		$("#confirmPass").val("");
		$("#passDlg").hide();
	}
	
	function saveMember() {
		if(confirm("确定要保存会员信息吗?")) {
			var action = $("#editForm").attr("action");
			action += "?oper=" + '<c:out value="${oper}"/>';
			$("#editForm").attr("action", action);
			$("#editForm").submit();
		}
	}
	
	function returnToList() {
		window.location.href='${pageContext.request.contextPath}/member/enterMemberList.do';
	}
	
</script>

<div id="content_right">
	<div style="width:100%;height:35px;line-height:35px;text-align:left;background-color:#F5FAFA;font-weight:bold; ">会员 > 会员管理 > 会员列表 > 编辑会员</div>
	<div>
		<div id="tabBar">
			<span class="curentTab">基本信息</span>
		</div>
		<div class="buttons" style="float:right; ">
			<a id="saveBtn" href="#">
				<img src="../images/btn_apply.png" alt=""/> 
				保存
			</a>
			<a id="returnBtn" href="#">
				<img src="../images/btn_apply.png" alt=""/> 
				返回列表
			</a>
		</div>
	</div>
	<div id="editContainer">
		<div id="baseInfo" class="editPanel">
			<span class="title">会员信息</span>
			<div style="clear:both;"></div>
			<div style="float:left; width:100%;margin-left:10px;">
			<form:form id="editForm" action="${pageContext.request.contextPath}/member/saveMember.do" commandName="member">
				<form:hidden path="sysId" />
				<table>
					<tr>
						<th>用户ID：</th>
						<td>
							${member.userId}
						</td>
					</tr>
					<tr>
						<th><a id="modifyPassBtn" href="#">修改会员密码</a></th>
						<td>
							
						</td>
					</tr>
					<tr>
						<th>会员等级：</th>
						<td>
							<form:select path="lev" cssStyle="width:100px; ">
							  <form:options items="${levList}" itemValue="itemValue" itemLabel="itemLabel"/>
						 	</form:select>
						</td>
					</tr>
					<tr>
						<th>当前积分：</th>
						<td>
							<form:input path="points" cssStyle="width:120px; " maxlength="10"/>
						</td>
					</tr>
					<tr>
						<th>会员名：</th>
						<td>
							${member.name}
						</td>
					</tr>
					<tr>
						<th>手机：</th>
						<td>
							<form:input path="mobile" cssStyle="width:120px; " maxlength="20"/>
						</td>
					</tr>
					<tr>
						<th>电话：</th>
						<td>
							<form:input path="phone" cssStyle="width:120px; " maxlength="20"/>
						</td>
					</tr>
					<tr>
						<th>电子邮件：</th>
						<td>
							<form:input path="mail" cssStyle="width:120px; " maxlength="50"/>
						</td>
					</tr>
					<tr>
						<th>地址：</th>
						<td>
							<select style="width:80px ">
								<option value="1" selected>全部</option>
								<option value="2">郴州市</option>
								<option value="3">北京市</option>
							</select>
							<select style="width:80px ">
								<option value="1" selected>全部</option>
								<option value="2">苏仙区</option>
								<option value="3">北湖区</option>
							</select>
							<select style="width:80px ">
								<option value="1" selected>全部</option>
								<option value="2">苏仙区</option>
								<option value="3">北湖区</option>
							</select>
							<select style="width:80px ">
								<option value="1" selected>全部</option>
								<option value="2">苏仙区</option>
								<option value="3">北湖区</option>
							</select>
							<form:input path="address" cssStyle="width:240px; " maxlength="40"/>
						</td>
					</tr>
					<tr>
						<th>注册日期：</th>
						<td>${member.joinTime}</td>
					</tr>
					<tr>
						<th>注册IP：</th>
						<td>${member.joinIp}</td>
					</tr>
					<tr>
						<th>最后登陆时间：</th>
						<td>${member.endTime}</td>
					</tr>
					<tr>
						<th>最后登陆IP：</th>
						<td>${member.endIp}</td>
					</tr>
				</table>
			</form:form>
			</div>
			<div style="clear:both;"></div>
		</div>
	</div>
</div>
<!--Stop member dialog start-->
<div id="passDlg" class="divDlg" style="display:none; width:400px;height:150px; ">
	<div class="header">会员密码修改</div>
	<div style="margin-top:10px; ">
		<table>
			<tr>
				<th>新密码：</th>
				<td>
					<input type="password" id="newPass" name="newPass" value="" style="width:120px;" maxlength="20"/>
				</td>
			</tr>
			<tr>
				<th>确认密码：</th>
				<td>
					<input type="password" id="confirmPass" name="confirmPass" value="" style="width:120px;" maxlength="20"/>
				</td>
			</tr>
		</table>
		<div class="buttons" style="margin-top:20px;margin-left:5px;">
			<a id="savePassBtn" href="#">
				<img src="../images/btn_apply.png" alt=""/> 
				保存
			</a>
			<a id="cancelStopBtn" href="#">
				<img src="../images/btn_cross.png" alt=""/> 
				取消
			</a>
		</div>
	</div>
</div>
<!--Stop member dialog end-->--%>